package com.zzyl.controller;

import com.zzyl.base.ResponseResult;
import com.zzyl.dto.LoginDto;
import com.zzyl.service.LoginService;
import com.zzyl.vo.UserVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @className: LoginController
 * @description:
 * @author: InnovatorX
 * @date: 2024/6/5 19:56
 * @Version: 1.0
 */
@Slf4j
@RestController
public class LoginController {
    @Autowired
    private LoginService loginService;
    /**
     * 后台登录
     * @param dto
     * @return
     */
    @PostMapping("/security/login")
    public ResponseResult<UserVo> login(@RequestBody LoginDto dto) {
      UserVo userVo =  loginService.login(dto);
        return ResponseResult.success(userVo);
    }
}
